var app = getApp();

Page({
    data: {
        assess_list: [],
        page: 1,
        reply: !1
    },
    onLoad: function(a) {
        console.log(a), this.setData({
            seller_id: a.seller_id,
            url: wx.getStorageSync("url")
        }), wx.setNavigationBarColor({
          frontColor: '#000000',
          backgroundColor: '#ffffff'
        }), this.refresh();
    },
    refresh: function(a) {
        var t = this, e = t.data.seller_id, s = t.data.assess_list, r = t.data.page;
        app.util.request({
            url: "entry/wxapp/AssessList",
            cachetime: "0",
            data: {
                seller_id: e,
                page: r
            },
            success: function(a) {
                if (console.log("这是酒店评价"), console.log(a), 0 < a.data.length) {
                    for (var e in t.setData({
                        page: r + 1,
                        none_more: !1
                    }), a.data) "" == a.data[e].reply && (a.data[e].img = a.data[e].img.split(","), 
                    a.data[e].time = app.ormatDate(a.data[e].time).slice(0, 10), s = s.concat(a.data[e]));
                    t.setData({
                        assess_list: s
                    });
                } else t.setData({
                    none_more: !0
                });
            }
        });
    },
    previewImage: function(a) {
        console.log(a);
        var e = this.data.url, t = [], s = a.currentTarget.id, r = a.currentTarget.dataset.index, o = this.data.assess_list;
        for (var n in o) if (s == o[n].id) var i = o[n].img;
        for (var l in i) t.push(e + i[l]);
        wx.previewImage({
            current: e + i[r],
            urls: t
        });
    },
    reply: function(a) {
        var e = this, t = e.data.reply;
        console.log(a);
        var s = a.currentTarget.dataset.id;
        e.setData({
            assess_id: s
        }), 0 == t ? e.setData({
            reply: !0
        }) : e.setData({
            reply: !1
        });
    },
    textarea: function(a) {
        this.setData({
            textarea: a.detail.value
        });
    },
    determine: function(a) {
        var e = this, t = e.data.textarea, s = e.data.assess_id;
        null == t || "" == t ? wx.showModal({
            title: "",
            content: "您还没有输入回复哦！"
        }) : (app.util.request({
            url: "entry/wxapp/ReplyAssess",
            cachetime: "0",
            data: {
                reply: t,
                assess_id: s
            },
            success: function(a) {
                console.log("这是回复酒店评价"), console.log(a);
            }
        }), e.setData({
            reply: !1
        }));
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {
        this.setData({
            assess_list: [],
            page: 1
        }), this.refresh();
    },
    onReachBottom: function() {
        this.refresh();
    }
});